<?php
include("../header.inc");
require_once("../DataBase.inc");
require_once("../staff/activities.inc");

$exam_center_id = $_GET["exam_center_id"];
$room = $_GET["room"];
$exam_id = $_GET["exam_id"];

$exam_center = DataBase::query("SELECT * FROM exam_center WHERE exam_center_id=".$exam_center_id);
$exam_center = $exam_center[0];
$exam = DataBase::query("SELECT * FROM exam WHERE exam_id=".$exam_id);
$exam = $exam[0];

$list = get_free_staff($exam["exam_date"],$exam["exam_start_time"],$exam["exam_end_time"],"supervisor","department.department_name");

?>
Exam Center: <?php echo $exam_center["exam_center_name"]?><br/>
Room: <?php echo $room?><br/>
Exam on <?php echo $exam["exam_date"]?> from <?php echo $exam["exam_start_time"]?> to <?php echo $exam["exam_end_time"]?><br/>
Who do you want to assign as supervisor ?<br/>
<form action="exam_center_assign_rooms.php?exam_center_id=<?php echo $exam_center_id?>" method="post">
<input type='hidden' name='room' value="<?php echo $room?>"/>
<input type='hidden' name='exam_id' value="<?php echo $exam_id?>"/>
<select name='supervisor'>
<option value=''></option>
<?php
foreach ($list as $staff) {
	echo "<option value='".$staff["username"]."'>".$staff['department_name']." Department: ".$staff["first_name"]." ".$staff["last_name"]."</option>";
}
?>
</select>
<br/>
<button type="submit">Assign</button>
</form>
Note: all staff in the list have the role of supervisor and are available during this time.<br/>
<br/>
<a href="exam_center_assign_rooms.php?exam_center_id=<?php echo $exam_center_id?>">Go back</a>
<?php include '../footer.inc';?>